Skip to content

fix(ui): send priority when creating condition rules - #1663

Open
dongyikuan919 wants to merge 1 commit into
apache:developfrom
dongyikuan919:fix/condition-rule-create-priority
Open

dongyikuan919 wants to merge 1 commit into
apache:developfrom
dongyikuan919:fix/condition-rule-create-priority

Conversation

@dongyikuan919

Copy link
Copy Markdown

Summary

Fixes #1659. Creating a condition rule from the form now includes the entered numeric priority in the POST payload. A blank field leaves the property omitted so the server can apply its default.

Evidence

  • Before, the component test submitted priority 12 and failed because the API mock received no priority field.
  • After, the same test sees priority: 12. A second case verifies that leaving the field empty still omits it.
  • yarn test passed all 77 tests and yarn vite build completed. The new test passes ESLint. The Vue file reports the same parser error on this branch and pristine develop.

Area

  • User Experience
  • Console

@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

@robocanic robocanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

优点

  • 改动范围小且精准:addByFormView.vue 中解构 priority 并仅在非空时写入 payload(...(isNil(priority) ? {} : { priority })),与后端 ConditionRule.Priority(pkg/console/model/condition_rule.go,json:"priority")契约一致;留空时省略字段,由服务端使用默认值。
  • priority: null as number | null 的类型标注让 a-input-number 的 v-model:value 与 payload 类型更准确。
  • 新增的 addByFormView.spec.ts 同时覆盖了“填写后提交”与“留空则省略”两个分支,断言的是真实的请求 payload,而不是实现细节。

问题

Critical

未发现。

Important

未发现。

总体评估

Ready to merge? Yes

未发现明显的 Critical / Important 问题,修复逻辑正确,测试能够覆盖核心行为。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Condition rule creation form omits the entered priority from the POST body

2 participants